/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.perilli.robertojustus.view;

import com.perilli.robertojustus.controller.UsuarioController;
import java.awt.Component;
import javax.swing.JFrame;

/**
 *
 * @author AEPI
 */
public class Home extends JFrame {

    /**
     * Creates new form Home
     */
    
    public Home() {
        initComponents();       
    }
    
    public void mostrarTela(Component c){
        jDesktopPane1.add(c);
        c.setVisible(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        jMenuBar = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        mnu_Cadastros = new javax.swing.JMenu();
        mni_Usuarios = new javax.swing.JMenuItem();
        mni_Categoria = new javax.swing.JMenuItem();
        mnu_Lancamentos = new javax.swing.JMenu();
        mni_CCorrente = new javax.swing.JMenuItem();
        mni_Poupanca = new javax.swing.JMenuItem();
        mni_Sair = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        mni_Debitos = new javax.swing.JMenuItem();
        mni_Creditos = new javax.swing.JMenuItem();
        mni_Taxas = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        mni_Agenda = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Home");

        javax.swing.GroupLayout jDesktopPane1Layout = new javax.swing.GroupLayout(jDesktopPane1);
        jDesktopPane1.setLayout(jDesktopPane1Layout);
        jDesktopPane1Layout.setHorizontalGroup(
            jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        jDesktopPane1Layout.setVerticalGroup(
            jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 279, Short.MAX_VALUE)
        );

        jMenu1.setText("Arquivo");
        jMenu1.setToolTipText("");

        mnu_Cadastros.setText("Cadastros");

        mni_Usuarios.setText("Usuarios");
        mni_Usuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_UsuariosActionPerformed(evt);
            }
        });
        mnu_Cadastros.add(mni_Usuarios);

        mni_Categoria.setText("Categoria");
        mnu_Cadastros.add(mni_Categoria);

        jMenu1.add(mnu_Cadastros);

        mnu_Lancamentos.setText("Lancamentos");

        mni_CCorrente.setText("Conta Corrente");
        mni_CCorrente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_CCorrenteActionPerformed(evt);
            }
        });
        mnu_Lancamentos.add(mni_CCorrente);

        mni_Poupanca.setText("Poupanca");
        mni_Poupanca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_PoupancaActionPerformed(evt);
            }
        });
        mnu_Lancamentos.add(mni_Poupanca);

        jMenu1.add(mnu_Lancamentos);

        mni_Sair.setText("Sair");
        mni_Sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_SairActionPerformed(evt);
            }
        });
        jMenu1.add(mni_Sair);

        jMenuBar.add(jMenu1);

        jMenu2.setText("Relatorios");

        mni_Debitos.setText("Debitos");
        jMenu2.add(mni_Debitos);

        mni_Creditos.setText("Creditos");
        jMenu2.add(mni_Creditos);

        mni_Taxas.setText("Taxas");
        jMenu2.add(mni_Taxas);

        jMenuBar.add(jMenu2);

        jMenu3.setText("Utilitarios");
        jMenu3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu3ActionPerformed(evt);
            }
        });

        mni_Agenda.setText("Agenda");
        mni_Agenda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mni_AgendaActionPerformed(evt);
            }
        });
        jMenu3.add(mni_Agenda);

        jMenuBar.add(jMenu3);

        setJMenuBar(jMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.Alignment.TRAILING)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mni_UsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_UsuariosActionPerformed
        // TODO add your handling code here:
        this.mostrarTela(new UsuarioController());
    }//GEN-LAST:event_mni_UsuariosActionPerformed

    private void mni_SairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_SairActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_mni_SairActionPerformed

    private void mni_CCorrenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_CCorrenteActionPerformed
        // TODO add your handling code here:
        this.mostrarTela(new LancamentoCc());
        
    }//GEN-LAST:event_mni_CCorrenteActionPerformed

    private void mni_PoupancaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_PoupancaActionPerformed
        // TODO add your handling code here:
        this.mostrarTela(new LancamentoPoupanca());
        
    }//GEN-LAST:event_mni_PoupancaActionPerformed

    private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jMenu3ActionPerformed

    private void mni_AgendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mni_AgendaActionPerformed
        // TODO add your handling code here:
        
        this.mostrarTela(new Agenda());
    }//GEN-LAST:event_mni_AgendaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Home().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar;
    private javax.swing.JMenuItem mni_Agenda;
    private javax.swing.JMenuItem mni_CCorrente;
    private javax.swing.JMenuItem mni_Categoria;
    private javax.swing.JMenuItem mni_Creditos;
    private javax.swing.JMenuItem mni_Debitos;
    private javax.swing.JMenuItem mni_Poupanca;
    private javax.swing.JMenuItem mni_Sair;
    private javax.swing.JMenuItem mni_Taxas;
    private javax.swing.JMenuItem mni_Usuarios;
    private javax.swing.JMenu mnu_Cadastros;
    private javax.swing.JMenu mnu_Lancamentos;
    // End of variables declaration//GEN-END:variables
}
